# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Jan-Erik Rediger <badboy at archlinux dot us>
pkgname=kcov
pkgver=41
pkgrel=3
pkgdesc="Code coverage tester for compiled programs, Python scripts and shell scripts"
arch=('loong64' 'x86_64')
url="https://simonkagstrom.github.io/kcov"
license=('GPL2')
depends=('elfutils' 'curl' 'zstd' 'zlib' 'binutils' 'libsframe.so')
makedepends=('cmake' 'python' 'ninja')
source=("https://github.com/SimonKagstrom/kcov/archive/v${pkgver}.tar.gz"
    0001-Add-basic-support-for-LoongArch-architecture.patch)
sha512sums=('4ba0eafe54e4e156a18c965c43bc9634db2e1f385ea4cf52e9123818b3addd31357b6857cd17490894eeb12554bb5a77e89b0657e5fdefa05696d2ac20058ae8'
            'e6f34cfbe6ed16c3c4288eacf7b68ed7428fe9690b4974329ce65d9efd413c73662409c7b76663e81b8bb56260499d9bf252ab7afffd3602f19981157eadd0cc')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i $srcdir/0001-Add-basic-support-for-LoongArch-architecture.patch
}

build() {
  cd $pkgname-$pkgver

  cmake \
    -GNinja \
    -Bbuild \
    -DCMAKE_INSTALL_PREFIX=/usr
  ninja -C build
}

package() {
  cd $pkgname-$pkgver

  DESTDIR="$pkgdir/" ninja -C build install
}

# vim:set ts=2 sw=2 et:
